<!DOCTYPE html>
<html lang="zh">
<head>
	#@header()
</head>
<body class="gray-bg">
	<div class="container-div">
		<div class="row">

			#if(permission != null && permission.get('select')!= null )
			<div class="col-sm-12 search-collapse" style="display: none" >
				<form id="role-form">
					<div class="select-list">
						<ul>
							<li>
								名称/编码：<input type="text" name="name"/>
							</li>

							<li>
								<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
							    <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
							</li>
						</ul>
					</div>
				</form>
			</div>
			#end

			<div class="btn-group-sm" id="toolbar" role="group">
				#if(permission != null && permission.get('add')!= null )
				<a class="btn btn-success" onclick="$.operate.add()">
	                <i class="fa fa-plus"></i> 新增
	            </a>
				#end

	        </div>
	        
	        <div class="col-sm-12 select-table table-striped">
			    <table id="bootstrap-table"></table>
			</div>
		</div>
	</div>


	#@footer()
	<script type="text/javascript">
		var editFlag = true;
		var removeFlag = true;
		$(function() {
		    var options = {
		        url: "#(prj)/admin/operate/paginate",
		        createUrl: "#(prj)/admin/operate/add",
		        updateUrl: "#(prj)/admin/operate/edit/{id}",
		        removeUrl: "#(prj)/admin/operate/delete/{id}",
		        exportUrl: "#(prj)/admin/operate/export",
		        sortName: "sort",
		        modalName: "操作功能",
                showSearch: true,
                showRefresh: false,
                showToggle: false,
                showColumns: false,

		        columns: [
		        {field: 'name', title: '操作名称'},
		        {field: 'code', title: '编码'},
		        {field: 'desc', title: '描述'},
		        {field: 'sort', title: '排序',sortable:true},
		        {field: 'create_time', title: '创建时间', sortable: true},
		        {
		            title: '操作',
		            align: 'center',
		            formatter: function(value, row, index) {
		            	if (row.roleId != 1) {
		                    var actions = []
                        #if(permission != null && permission.get('update')!= null )
		                    actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ')
						#end
                        #if(permission != null && permission.get('delete')!= null )
		                    actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a> ')
						#end

		                    return actions.join('');
		            	} else {
		                    return "";
		                }
		            }
		        }]
		    };
		    $.table.init(options);
		});


	</script>
</body>
</html>